#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main(int argc, char const *argv[])
{
    bool flag;
    int n, *arr;
    int i, j;
    cin >> n;
    arr = new int[n + 1];
    for (i = 0; i <= n; i++)
    {
        cin >> arr[i];
    }
    flag = true;
    for (i = 0, j = n; i <= n; i++, j--)
    {
        if (arr[i] == 0)
        {
            continue;
        }
        flag = false;
        if (arr[i] > 0 && i != 0)
        {
            cout << "+";
        }
        if (arr[i] == -1)
        {
            if (j == 0)
            {
                cout << "-1";
            }
            else
            {
                cout << "-";
            }
                        
        }
        else if (arr[i] != 1 || j == 0)
        {
            cout << arr[i];
        }
        if (j > 0)
        {
            cout << "x";
        }
        if (j > 1)
        {
            cout << "^" << j;
        }
    }
    if (flag)
    {
        cout << 0;
    }
    return 0;
}
